package org.shj.demo;

import com.hankcs.hanlp.corpus.synonym.Synonym;
import com.hankcs.hanlp.dictionary.CoreSynonymDictionary;
import com.hankcs.hanlp.dictionary.common.CommonSynonymDictionary;

/**
 * @author Shen Huang Jian
 * @date 2020-10-14 18:15
 */
public class SynonymDemo {

    public static void main(String[] args){
        /*System.out.println("五  门  则枯顶替".replaceAll(" ", ""));
        String text = "王word cut清";
        for(char c : text.toCharArray()){
            System.out.println(c + ": " + String.valueOf(c).matches("[\u4e00-\u9fa5]"));
        }*/
        String[] texts = {"挪车", "体育", "伤心", "占用"};
        for(String text : texts){
            CommonSynonymDictionary.SynonymItem synonymItem = CoreSynonymDictionary.get(text);
            System.out.println(synonymItem);
            if(synonymItem == null){
                continue;
            }
            for(Synonym synonym : synonymItem.synonymList){
                System.out.print(synonym.realWord + ", ");
            }
            System.out.println();
        }

    }

}
